import Vue from "vue";
import App from "./App.vue";
// 关闭生产提示
Vue.config.productionTip = false;

// vuex
import store from "./store";

// router
import router from "./router";

// element
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);

// 注册全局时间过滤器
import dayjs from "dayjs";
Vue.filter("timeFilter", function (value) {
    return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
});
// 注册全局金额过滤器
Vue.filter("priceFilter", function (value) {
    return value == "0" ? 0 : (value = value.slice(0, value.length - 2) + "." + value.slice(value.length - 2));
});

// 全局组件
import CustomLine from "./components/CustomLine";
Vue.component("CustomLine", CustomLine);

new Vue({
    router,
    store,
    render: (h) => h(App),
    beforeCreate() {
        // 安装全局事件总线
        Vue.prototype.$bus = this;
    },
}).$mount("#app");
